<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8" import="community.domain.*,java.util.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<%
Question question = (Question)request.getAttribute("question");
ArrayList<DLAllComment> flclist = (ArrayList<DLAllComment>)question.getXkkdlcomments(); %>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="<%=request.getContextPath() %>/static/css/comment.css" rel="stylesheet">
<link href="<%=request.getContextPath() %>/static/css/bootstrap.min.css" rel="stylesheet">

<script src="https://cdn.static.runoob.com/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdn.static.runoob.com/libs/bootstrap/3.3.7/js/bootstrap.min.js"></script>

<title>问题详情</title>
</head>
<body style="background-color:#f8f8f8">
<div class="qaarea">
	<div class="qaall">
	<!-- 问题部分 -->
		<div class="qadiv">
			<p class="qtitle"><%=question.getQtitle() %></p>
			<p><%=question.getQcontent() %></p>
			<div>
				<img src="<%=request.getContextPath() %>/static/image/资源 3.png"/>
				<%=question.getUsername() %> 
				<p class="qatime"> - 提问时间：<%=question.getDate() %></p>
				<br/><br/>
				<button>邀请回答</button>
				<button>我要回答</button>
				<button>+关注</button>
				<button>分享</button>
			</div>
		</div>
	</div>

<!-- 回答 -->

<div class="aall"  >
<div class="qadiv">
<p class="acount"><%=question.getCnum() %>个回答</p>
<!-- 回答的循环从这里开始 -->
<%for(DLAllComment flc : flclist){ %>
<div class="aone">
<br/>
<div>
<img class="tx" src="<%=request.getContextPath() %>/static/image/bigtx.jpg"/>
<%=flc.getMycomment().getUsername() %> 
<br/><br/>
<p><%=flc.getMycomment().getCcontent() %></p>
<p class="qatime">发布于 <%=flc.getMycomment().getDateFormatted() %></p>
<div style="margin-bottom:30px;">
	<img src="<%=request.getContextPath() %>/static/image/资源 5.png"/> 
	<p class="qatime">
	<a class="qatime" data-toggle="collapse" data-parent="#accordion" href="#collapse<%=flc.getMycomment().getCid()%>">评论&nbsp;<%=flc.getMyreplylist().size() %></a></p>
	<img src="<%=request.getContextPath() %>/static/image/资源 7.png"/> <p class="qatime">点赞</p>
	<img src="<%=request.getContextPath() %>/static/image/资源 9.png"/> <p class="qatime">收藏</p>
	<p class="qatime" style="margin-left:30px">没有帮助？</p>
</div>

</div>
<!-- 回复  展示有点问题！-->
<div id="collapse<%=flc.getMycomment().getCid()%>" class="panel-collapse collapse" style="background:url(<%=request.getContextPath()%>/static/image/commentbg.jpg) no-repeat;border:0 1px 1px 1px solid;background-color:#f8f8f8;background-size:100%;border-radius:6px">
            <div class="panel-body">
<%for(Comment c:flc.getMyreplylist()){ %>
<div class="row">
<div class="col-xs-1">
<img src="<%=request.getContextPath() %>/static/image/资源 3.png"/>
</div>
<div class="col-xs-11">
<p>
<a onclick="commentonwho(<%=c.getFromuid() %>,<%=flc.getMycomment().getCid() %>,'<%=c.getUsername() %>')"><%=c.getUsername() %></a> 回复
<a onclick="commentonwho(<%=c.getTouid() %>,<%=flc.getMycomment().getCid() %>,'<%=c.getTousername() %>')"> <%=c.getTousername() %></a>:
</p>
<p style="border-bottom: 1px dotted">
<%=c.getCcontent() %>
</p>
</div>
</div>
<!-- 回复结束 -->
<%} %>

<div class="row">
<div class="col-xs-1">
</div>
<div class="col-xs-11">

				<form method="post" action="<%=request.getContextPath() %>/Comment/AddComment">
				<input type="hidden" id="touid<%=flc.getMycomment().getCid() %>" class="form-control" name="touid<%=flc.getMycomment().getCid() %>" value="<%=flc.getMycomment().getFromuid()%>"/>
                    <input type="hidden"  class="form-control" name="fromuid" value="<%=2%>"/>
                    <input type="hidden" class="form-control" name="qid" value="<%=flc.getMycomment().getQid()%>"/>
                    <input type="hidden" class="form-control" name="tocid" value="<%=flc.getMycomment().getCid()%>"/>
                    
                   
				<div class="input-group">
				 <input type="text" class="form-control" id="content<%=flc.getMycomment().getCid() %>" name="content"/>
                    <span class="input-group-btn">
                        <input type="submit" class="btn btn-default" value="提交" />
                    </span>
                    
                </div><!-- /input-group -->
                    </form>
</div>
</div>

</div>
</div>
<br/>
<br/>
</div>
<%} %>
<!-- 回答的循环结束 -->

</div>
</div>
</div>

<!-- 侧边栏开始 -->
<div class="sidearea">
<p class="sidetitle">父话题</p>
<div class="row" >
	<div class="col-xs-4">
	<img  src="<%=request.getContextPath() %>/static/image/资源 9.png" width="80px" height="80px"/>
	</div>
	<div class="col-xs-8" align="center">
	<p class="sidetitle">#<%=question.getTopicname() %>#</p>
	<p >问答：16 关注：101</p>
	<button >关注</button>
</div>
</div>

<div class="sidetitle row" style="margin-top:30px" >
	<div class="col-xs-6 text-left">
		相关问题
	</div>
	<div class="col-xs-6 text-right relqcount">
		查看全部>
	</div>
</div>
<!-- 循环开始 -->
<div class="row" >
	<div class="col-xs-2">
	<img  src="<%=request.getContextPath() %>/static/image/资源 9.png" width="40px" height="40px"/>
	</div>
	<div class="col-xs-10" align="left" >
	<p class="relqtitle" style="margin-right:30px;">大学生如何申请管培生计划？</p>
	<p class="relqcount" style="margin-right:30px;">3个回答</p>
</div>
<!-- 结束 -->

</div>
</div>
<!-- 侧边栏结束 -->

<script>
function commentonwho(uid,cid,username){
	var a= uid;
	var b = cid;
	var c= username;
	var inputtouid = document.getElementById("touid"+b);
	var inputcontent = document.getElementById("content"+b);
	//alert(uid+"---"+c);
	inputtouid.value = a;
	inputcontent.placeholder = "@"+c+":";
}
</script>
</body>
</html>